#pragma once

#include <session.h>
#include <boost/asio.hpp>
#include <unordered_map>
#include <string>

class AsyncServer {
public:
	AsyncServer(boost::asio::io_context& ioct);
	void startAccept();
	bool clearSession(std::string sessionId);
	void start();
private:
	void acceptHandler(std::shared_ptr<Session> session, const boost::system::error_code& error);

private:
	boost::asio::io_context& ioct_;
	std::unordered_map<std::string, std::shared_ptr<Session>> sessionMap_;
	std::shared_ptr<boost::asio::ip::tcp::acceptor> accptor_;
};